import java.util.Arrays;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: zhongyisheng
 * Date: 2024-05-13
 * Time: 16:49
 */
public class Test {
    public static int[] func2(int[] array,int target){
        int[] ret= new int[]{-1,-1};
        for (int i = 0; i < array.length; i++) {
            for (int j = i+1; j < array.length; j++) {
                if(array[i]+array[j]==target){
                    ret[0]=i;
                    ret[1]=j;
                }
            }
        }
        return ret;
    }
    public static void main(String[] args) {
         int[] array=new int[]{2,7,11,15};
         int[] ret=func2(array,9);
        System.out.println(Arrays.toString(ret));
    }

    public static void func1(int[] array){
        int left = 0;
        int right = array.length-1;
        while(left<right){
            while((left<right)&&(array[left]%2!=0)){
                left++;
            }
            while((left<right)&&(array[right]%2==0)){
                right--;
            }
            swap(array,left,right);
        }
    }
    public static void swap(int[] array,int i,int j){
        int tmp = array[i];
        array[i]=array[j];
        array[j]=tmp;
    }
    public static void main2(String[] args) {
        int[] array={1,2,3,4,5,6,7,8,9};
        func1(array);
        System.out.println(Arrays.toString(array));

    }
    public static void func(int[] array){

    }

    public static void main1(String[] args) {
        int[] array = {1,2,3};

    }
}
